package com.weiyuwqj.utils.converter;

import org.springframework.core.convert.converter.Converter;

import java.math.BigDecimal;

public class BigDecimalConverter implements Converter<String,BigDecimal> {

    @Override
    public BigDecimal convert(String text) {
        if (text==null||text.isEmpty())return BigDecimal.ZERO;
        try {
            return BigDecimal.valueOf(Double.parseDouble(text));
        } catch (Exception e) {
        }
        return BigDecimal.ZERO;
    }

}
